package View.GeneralManagerView.VariablePanel;


public class rollList extends VariablePane{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	
	public void setText(String[] s){
		InputField t[] = super.contains.inputBox;
		for(int j=0;j<t.length;j++){
			((UneditableTextField)t[j]).setText(s[j]);
		}
	}
	
	public rollList(int width,int height,String...args){
		super(width,height);
		String tmp[] = new String[args.length];
		for(int i=0;i<tmp.length;i++){
			if(i%2==0){
				tmp[i] = args[i];
			}else{
				tmp[i] = "UneditableTextField";
			}
		}
		try {
			super.addItems(tmp);
		} catch (InstantiationException | IllegalAccessException
				| ClassNotFoundException e) {
			e.printStackTrace();
		}
		
		InputField t[] = super.contains.inputBox;
		for(int j=0;j<t.length;j++){
			((UneditableTextField)t[j]).setText(args[j*2+1]);
		}
		
	}
	
	/*
	public void setTextList(String [] textFieldList){
		for(int i=0;i<textFieldList.length;i++){
			textList[i].setText(textFieldList[i]);
		}
	}
	
	public rollList(String []labelList){
		String[] tmpList = new String[labelList.length];
		for(int i=0;i<tmpList.length;i++){
			tmpList[i] = "";
		}
		init(labelList,tmpList);
	}
	
	public rollList(String []labelList,String []textFieldList){
		init(labelList,textFieldList);
	}
	
	
	private void init(String []labelList,String []textFieldList){
		panel.setBorder(new LineBorder(new Color(64, 64, 64), 5, true));
		panel.setLayout(new MigLayout("", "[106px][66px]", "[21px][21px][21px][][][][][]"));
		
		this.labelList = new JLabel[labelList.length];
		this.textList = new JTextField[textFieldList.length];
		
		for(int i=0;i<labelList.length;i++){
			JLabel l = new JLabel(labelList[i]);
			panel.add(l, "cell 0 +"+(4+i)+",alignx center,aligny top");
			this.labelList[i] = l;
			
			JTextField textField = new JTextField();
			textField.setColumns(10);
			textField.setText(textFieldList[i]);
			textField.setEditable(false);
			panel.add(textField, "cell 1 "+(4+i)+",alignx center,aligny top");
			this.textList[i] = textField;
		}
	}
	
	public JPanel getPanel(){
		return panel;
	}*/
}
